Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented May 25, 2023

Closes: #9773

Description

We now reconnect to the reader automatically on foregrounding the app, if the device and store support it and TTP has been used before.

For users which grant allow once permissions, this means that in the next app session (i.e. after it's been force quit or kicked from memory), they’ll be asked to provide location permission without the context of a payment attempt, which is strange – the system permission alert pops up over whatever screen they happen to be on, interrupting their flow.

With this change, we only attempt to reconnect if we already have location permission – this means we no longer show a location permission request out of context.

Users who choose to allow once will still get the benefit of automatic reconnection when the app is foregrounded, but only after they first connect to the TTP reader in that app session.

Testing instructions

Using a US-based store with WCPay, an iPhone XS or newer, and iOS 16+

  1. Launch the app
  2. Take a tap to pay payment
  3. Force close the app
  4. Launch Settings and go to Woo's page
  5. Change location permissions to Ask Next Time Or When I Share
  6. Go back in to the app
  7. Observe that you are not shown a Location permission alert
  8. Navigate to Menu > Payments > Collect Payment
  9. Collect a Tap to Pay on iPhone payment
  10. Observe that you have to do a full reader connection (takes 7-12s) before the Apple payment screen is shown – i.e. the reader did not automatically reconnect
  11. In this time you will be asked for location permissions – select Allow once
  12. Background the app
  13. Foreground the app, wait a few seconds, and take another TTP payment
  14. Observe that you go directly to the Apple payment screen – i.e. the reader automatically reconnected when you foregrounded the app.

Screenshots


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

We reconnect to the reader automatically on foregrounding the app, if the device and store support it and TTP has been used before.

For users which grant `allow once` permissions, this means that in the next app session, they’ll be asked to provide location permission without the context of a payment attempt, which is strange – the system permission alert pops up over whatever screen they happen to be on, interrupting their flow.

With this change, we only attempt to reconnect if we already have location permission – this means we no longer show a location permission request out of context.
@joshheald joshheald added type: enhancement A request for an enhancement. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. labels May 25, 2023
@joshheald joshheald added this to the 13.9 milestone May 25, 2023
@joshheald joshheald marked this pull request as ready for review May 25, 2023 13:17
@joshheald joshheald requested a review from iamgabrielma May 25, 2023 13:17
@joshheald
Copy link
Contributor Author

I've put this down for 13.9 – no rush @iamgabrielma

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 25, 2023

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr9821-1175919 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@iamgabrielma iamgabrielma self-assigned this May 29, 2023
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well! LGTM 🚢

guard supportDeterminer.siteSupportsLocalMobileReader(),
guard supportDeterminer.locationIsAuthorized,
supportDeterminer.siteSupportsLocalMobileReader(),
await supportDeterminer.deviceSupportsLocalMobileReader(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this PR, but TIL we can suspend the guard until the await chain has been resolved 💯

@joshheald joshheald enabled auto-merge May 30, 2023 09:36
@joshheald joshheald merged commit 68bbc4c into trunk May 30, 2023
@joshheald joshheald deleted the issue/9773-prevent-ttp-reconnection-if-no-location-permission branch May 30, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mobile Payments] Prevent Tap to Pay reconnection if location permissions not determined

4 participants